package models

import "time"

type OrderInfo struct {//订单表
	Id 				int
	OrderId         string  `orm:"unique"`
	User 			*User	`orm:"rel(fk)"`		//用户
	Address 		*Address`orm:"rel(fk)"`		//地址
	PayMethod 		int							//付款方式
	TotalCount 	int		`orm:"default(1)"`	//商品数量
	TotalPrice 	int							//商品总价
	TransitPrice 	int							//运费
	OrderStatus 	int 	`orm:"default(1)"`	//订单状态
	TradeNo 		string	`orm:"default('')"`	//支付编号
	Time			time.Time `orm:"auto_now_add"`		//评论时间

	OrderGoods   []*OrderGoods `orm:"reverse(many)"`
}

type OrderGoods struct {//订单商品表
	Id 			int
	OrderInfo 	*OrderInfo	`orm:"rel(fk)"`	//订单
	GoodsSKU 	*GoodsSKU	`orm:"rel(fk)"`	//商品
	Count 		int		`orm:"default(1)"`	//商品数量
	Price 		int							//商品价格
	Comment 	string	`orm:"default('')"` //评论
}
